package leetcode.jianzhioffer;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-11-10 23:42
 **/
public class JianZhiOffer56II {

    public int singleNumber(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);
        }
        int res = 0;
        for (int num : nums) {
            if (map.get(num) == 1) {
                res = num;
            }
        }
        return res;
    }


    public static void main(String[] args) {
        int num = 8;
        int n = 1;
        while (num > n) {
            n <<= 1;
        }
        System.out.println(n);
    }

}
